<template>
  <el-row class="container">
    <el-col :span="24" class="header">
      <el-col class="logo" :class="{collapse:isCollapse}"><span :class="{hide:isCollapse}">竞答评分</span></el-col>
      <el-col class="tools">
        <div class="tools-content" @click.prevent="collapse">
					<i class="el-icon-s-unfold" v-if="isCollapse"></i>
          <i class="el-icon-s-fold" v-else></i>
				</div>
      </el-col>
      <!-- <el-col class="user-info">
        <el-dropdown style="height:44px;">
					<span class="el-dropdown-link userinfo-inner" style="color:#fff;font-size:18px;">{{userName}}<i class="el-icon-arrow-down el-icon--right"></i></span>
					<el-dropdown-menu slot="dropdown">
						<el-dropdown-item><span @click="loginOut">退出登录</span></el-dropdown-item>
					</el-dropdown-menu>
				</el-dropdown>
      </el-col> -->
    </el-col>
    <el-col :span="24" class="main">
     <!-- <el-scrollbar style="height:100%"> -->
        <aside class="aside-menu" :class="{collapse:isCollapse}">
          <vue-scroll :ops="ops1">
        <el-menu 
          class="el-menu"
          :collapse="isCollapse"
          :default-active="$route.path"
          unique-opened 
          router
          background-color="#222d32"
          text-color="#b8c7ce"
          active-text-color="#fff"
          >
          <el-submenu index="6">
            <template slot="title">
              <i class="el-icon-s-shop"></i>
              <span slot="title">答卷管理</span>
            </template>
            <el-menu-item index="/answerSheet" >
              <i class="el-icon-box"></i>
              <span slot="title">答卷列表</span>
            </el-menu-item>

          </el-submenu>
          <el-submenu index="7">
            <template slot="title">
              <i class="el-icon-s-shop"></i>
              <span slot="title">实时排名</span>
            </template>
            <el-menu-item index="/rank" >
              <i class="el-icon-box"></i>
              <span slot="title">排行榜</span>
            </el-menu-item>

          </el-submenu>
        </el-menu>
          </vue-scroll>
      </aside>
     <!-- </el-scrollbar> -->
     <vue-scroll :ops="ops">
      <section class="content-container">
        <el-col :span="24" class="content-wrapper">
          <transition name="fade" mode="out-in">
            <router-view></router-view>
          </transition>
        </el-col>
      </section>
     </vue-scroll>
    </el-col>
  </el-row>
</template>

<script>
export default {
  data(){
    return{
      loginType:'',//登录类型
      hasOpenShop:'',//是否已开店
      ops1:{
        bar:{
          showDelay: 2000,
          size:'10px',
          minSize:'0.5',
          keepShow:true,
          opacity:0
        }
      },
      ops:{
        bar:{
          showDelay: 2000,
          size:'10px',
          minSize:'0.5',
          keepShow:true
        }
      },
      isCollapse: false,
      userName:'',
      user_token:''
    }
  },
  mounted(){
    this.getUserInfo();
  },
  methods:{
    //折叠导航栏
    collapse(){
      this.isCollapse = !this.isCollapse;
    },
    //退出登陆
    loginOut(){
      this.$api.loginOut();
      window.localStorage.clear()
    },
    getUserInfo(){
      this.userName=window.localStorage.getItem('user_name');
      this.user_token=window.localStorage.getItem('user_token')
    },
  }
}
</script>
<style lang='scss' scoped>
  @import '../../assets/css/vars.scss';
  .container{
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    .header{
      height: 50px;
      line-height: 50px;
      text-align: center;
      font-size: 24px;
      color: #fff;
      background-color: $color-primary;
      display: flex;
      .logo{
        width: 230px;
        height: 100%;
        font-size: 20px;
        border-right:1px solid #eef1f6;
        transition: all .3s linear;
      }
      .tools{
        height: 100%;
        flex: 4;
        position: relative;
        .tools-content{
          height: 50px;
          line-height: 50px;
          position: absolute;
          left:10px;
          cursor: pointer;
        }
      }
      .user-info{
        height: 100%;
        flex: 1
      }
    }
    .main{
      display: flex;
      position: absolute;
      top: 50px;
			bottom: 0px;
      overflow: hidden;
      .aside-menu{
        width: 269px;
        // height: 100vh;
        transition: all .3s linear;
        background:#222d32;
        // overflow-x: hidden;
      }
      .content-container{
        flex: 1;
				padding: 20px;
        // overflow-y: scroll;
        .breadcrumb-container{
          display: flex;
          justify-content: space-between;
          align-items: center;
          .breadcrumb-name{
            font-weight: bolder;
            color: #475669;
          }
        }
      }
    }
    .collapse{
      width: 65px !important;
    }
    .hide{
      display: none !important;
    }
    .dialog-footer{
			text-align: center;
		}
  }
</style>

<style lang="scss">
@import '../../assets/css/vars.scss';
  .el-menu{
    border-right:1px solid #222d32;
  }
  .el-menu-item.is-active{
    background-color:$navbar-background!important;
  }

</style>
